package com.link4a.doms.dao.handler;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.link4a.doms.dao.Page;
import com.link4a.doms.dao.SqlSessionTemplateSupport;
import com.link4a.doms.model.Order;
import com.link4a.doms.vo.OrderCondition;

@Repository
public class OrderHandler extends SqlSessionTemplateSupport {

	
	public Order findById(String id) {
		return getSqlSession().selectOne("findById", id);
	}
	
	public Page<Order> findPage(OrderCondition orderCondition) {
		return findPage(orderCondition, "countPage", "findPage");
	}
	
	public void merge(Order order) {
		getSqlSession().insert("merge", order);
	}
	
	public void delete(String id) {
		getSqlSession().delete("delete", id);
	}
	
	public void updateStatus(String id, String status) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("status", status);
		getSqlSession().update("updateStatus", param);
	}
}